package com.cnipr.patent;

import java.util.Date;
import java.util.HashMap;

import com.chinasofti.framework.data.Entity;
import com.chinasofti.framework.data.EntityDataAccessable;
import com.chinasofti.framework.data.FieldType;
import com.chinasofti.framework.dataaccess.IReadDataAccess;
import com.chinasofti.framework.parser.XmlParser;

public class Patent extends EntityDataAccessable {

	private static HashMap<String, FieldType> m_fields;
	private static final String ENTITY_NAME = "Patent";
	private static final String KEY_FIELD = "an";
	
	
	public static final String FIELD_NAME = "name";
	public static final String FIELD_AN = "an";
	public static final String FIELD_PD = "pd";
	public static final String FIELD_PIC = "pic";
	public static final String FIELD_PNM = "pnm";
	public static final String FIELD_PA = "pa";
	public static final String FIELD_GPA = "gpa";
	
	
	@Override
	protected void init() {
		if(m_fields == null) {
			m_fields = new HashMap<String, FieldType>();
			m_fields.put(FIELD_NAME, new FieldType(String.class));
			m_fields.put(FIELD_AN, new FieldType(String.class));
			m_fields.put(FIELD_PD, new FieldType(Date.class));
			m_fields.put(FIELD_PIC, new FieldType(String.class));
			m_fields.put(FIELD_PNM, new FieldType(String.class));
			m_fields.put(FIELD_PA, new FieldType(String.class));
			m_fields.put(FIELD_GPA, new FieldType(Integer.class));
		}
	}

	@Override
	public XmlParser<? extends Entity> getParser() {
		return new PatentParser();
	}

	@Override
	public HashMap<String, FieldType> getFieldTypes() {
		return m_fields;
	}

	@Override
	public String getKeyField() {
		return KEY_FIELD;
	}

	@Override
	public String getEntityName() {
		return ENTITY_NAME;
	}

	@Override
	public IReadDataAccess<? extends Entity> getDataAccessObject() {
		// TODO Auto-generated method stub
		return null;
	}

}
